<template>
	<view class="content">
		<!--顶部标题-->
		<view class="box-top">
			<span class="line"></span>
			<span class="line"></span>
			<span class="line"></span>
			<span class="line"></span>
			<view class="main-box">
				<!--头像-->
				<u-avatar src="https://yj.xiesinder.cn/prophet/logo.png" size="80"></u-avatar>
			</view>
			<view class="title">
				<h1>理先知GZIST</h1>
			</view>
		</view>
		<view class="box-body">
			<span class="line"></span>
			<span class="line"></span>
			<span class="line"></span>
			<span class="line"></span>
			<!--中间内容-->
			<view class="body-title">
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
			</view>
			<view class="body-content">
				<rich-text :nodes="about"></rich-text>
			</view>
		</view>
		<view class="box-bottom">
			<div class="eye"></div>
			<div class="mouth1"></div>
			<div class="mouth2"></div>
			<div class="beanOne"></div>
			<div class="beanTwo"></div>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex'
	import { getAbout } from '@/plugins/api/static.js'
	export default {
		data() {
			return {
				about: ""
			}
		},
		onLoad() {
			this.getAboutInfo()
		},
		onShow() {},
		// 计算属性
		computed: {
			...mapState('user', ['modalShow', 'loginState', 'openId'])
		},
		methods: {
			...mapActions('user', ['openModalAction']),
			getAboutInfo() {
				getAbout().then(res => {
					this.about = res.data.data
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	page {
		background: #f8f8f8;
	}

	.content {
		width: 100%;

		// 顶部
		.box-top {
			width: 90%;
			height: 300rpx;
			left: 5%;
			position: relative;
			/* 超出隐藏需要加上 */
			overflow: hidden;

			.main-box {
				float: left;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				height: 220rpx;
				width: 100%;
			}

			.title {
				float: left;
				text-align: center;
				height: 80rpx;
				width: 100%;
				font-size: 40rpx;

				/* 加上 -webkit- 注意兼容 */
				h1 {
					background: -webkit-linear-gradient(135deg,
							#0eaf6d,
							#ff6ac6 25%,
							#147b96 50%,
							#e6d205 55%,
							#2cc4e0 60%,
							#8b2ce0 80%,
							#ff6384 95%,
							#08dfb4);
					/* 文字颜色填充设置为透明 */
					-webkit-text-fill-color: transparent;
					/* 背景裁剪，即让文字使用背景色 */
					-webkit-background-clip: text;
					/* 背景图放大一下，看着柔和一些 */
					-webkit-background-size: 200% 100%;
					/* 应用动画flowCss 12秒速度 无限循环 线性匀速动画*/
					-webkit-animation: flowCss 12s infinite linear;
				}

				@-webkit-keyframes flowCss {
					0% {
						/* 移动背景位置 */
						background-position: 0 0;
					}

					100% {
						background-position: -400% 0;
					}
				}

				h1:hover {
					-webkit-animation: flowCss 4s infinite linear;
				}
			}
		}

		// 中间内容
		.box-body {
			width: 90%;
			height: 800rpx;
			left: 5%;
			position: relative;
			/* 超出隐藏需要加上 */
			overflow: hidden;
			margin-top: 30rpx;
			box-shadow: 0 2rpx 4rpx 0 rgba(0, 0, 0, 0.2), 0 3rpx 6rpx 0 rgba(0, 0, 0, 0.19);

			.body-title {
				float: left;
				display: flex;
				align-items: center;
				justify-content: center;
				height: 50rpx;
				width: 100%;
			}

			.body-content {
				float: left;
				align-items: center;
				justify-content: center;
				height: 700rpx;
				padding-top: 60rpx;
				width: 80%;
				padding-left: 10%;
				color: #848484;
				line-height: 55rpx;
				text-indent: 2em;
			}

			.body-title span {
				width: 6rpx;
				border-radius: 18rpx;
				margin-right: 6rpx;
			}

			.body-title span:nth-child(1) {
				/* 时间递增，参差不齐的效果 */
				animation: bar1 2s 0.2s infinite linear;
			}

			.body-title span:nth-child(2) {
				animation: bar2 2s 0.4s infinite linear;
			}

			.body-title span:nth-child(3) {
				animation: bar3 2s 0.6s infinite linear;
			}

			.body-title span:nth-child(4) {
				animation: bar4 2s 0.8s infinite linear;
			}

			.body-title span:nth-child(5) {
				animation: bar5 2s 1.0s infinite linear;
			}

			.body-title span:nth-child(6) {
				animation: bar6 2s 1.2s infinite linear;
			}

			.body-title span:nth-child(7) {
				animation: bar7 2s 1.4s infinite linear;
			}

			.body-title span:nth-child(8) {
				animation: bar8 2s 1.6s infinite linear;
			}

			.body-title span:nth-child(9) {
				animation: bar9 2s 1.8s infinite linear;
			}

			@keyframes bar1 {
				0% {
					background: #f677b0;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #f677b0;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #f677b0;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar2 {
				0% {
					background: #df7ff2;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #df7ff2;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #df7ff2;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar3 {
				0% {
					background: #8c7ff2;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #8c7ff2;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #8c7ff2;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar4 {
				0% {
					background: #7fd0f2;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #7fd0f2;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #7fd0f2;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar5 {
				0% {
					background: #7ff2d3;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #7ff2d3;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #7ff2d3;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar6 {
				0% {
					background: #7ff2a0;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #7ff2a0;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #7ff2a0;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar7 {
				0% {
					background: #adf27f;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #adf27f;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #adf27f;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar8 {
				0% {
					background: #e7f27f;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #e7f27f;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #e7f27f;
					height: 10%;
					margin-top: 25%;
				}
			}

			@keyframes bar9 {
				0% {
					background: #ecaa64;
					margin-top: 25%;
					height: 10%;
				}

				50% {
					background: #ecaa64;
					height: 100%;
					margin-top: 0%;
				}

				100% {
					background: #ecaa64;
					height: 10%;
					margin-top: 25%;
				}
			}
		}

		// 底部
		.box-bottom {
			display: inline-block;
			position: relative;
			margin: 120rpx;
		}

		/* 使用伪元素创建吃豆人的眼睛 */
		.box-bottom::before {
			content: '';
			width: 0.4em;
			height: 0.4em;
			border-radius: 50%;
			background-color: #333;
			position: absolute;
			top: 6px;
			left: 21px;
			z-index: 2000;
		}

		/* mouth1搭配mouth2组成吃豆人张嘴闭嘴的动画 */
		.mouth1 {
			width: 0;
			height: 0;
			border: 25px solid #E1B204;
			border-radius: 50%;
			border-right-color: transparent;
			animation: upup .32s 0s infinite;
			position: relative;
			z-index: 3;
		}

		@keyframes upup {
			0% {
				transform: rotate(270deg);
			}

			50% {
				transform: rotate(1turn);
			}

			100% {
				transform: rotate(270deg);
			}
		}

		.mouth2 {
			width: 0;
			height: 0;
			border: 25px solid #E1B204;
			border-right-color: transparent;
			border-radius: 25px;
			margin-top: -50px;
			animation: downdown .32s 0s infinite;
			position: relative;
			z-index: 3;
		}

		@keyframes downdown {
			0% {
				transform: rotate(90deg);
			}

			50% {
				transform: rotate(0);
			}

			100% {
				transform: rotate(90deg);
			}
		}

		/* 豆子不断移动 */
		.beanOne {
			background-color: #E1B204;
			border-radius: 50%;
			width: 10px;
			height: 10px;
			position: absolute;
			transform: translateY(-6px);
			top: 25px;
			left: 100px;
			animation: beanAnimation 1s linear .52s infinite;
		}

		.beanTwo {
			background-color: #E1B204;
			border-radius: 50%;
			width: 10px;
			height: 10px;
			position: absolute;
			transform: translateY(-6px);
			top: 25px;
			left: 100px;
			animation: beanAnimation 1s linear 1.1s infinite;
		}


		@keyframes beanAnimation {
			75% {
				opacity: .72;
			}

			100% {
				transform: translate(-100px, -6px);
			}
		}

		.line {
			/* 结合外层元素的相对定位 */
			position: absolute;
		}

		.line:nth-child(1) {
			top: 0;
			left: 0;
			width: 100%;
			height: 3px;
			/* 加上渐变效果，方可形成拖尾效果 */
			background: linear-gradient(90deg, transparent, orange);
			animation: animate1 8s linear infinite;
		}

		/* 分别控制其上下左右的定位距离，从而形成线条跟随效果 */
		@keyframes animate1 {
			0% {
				left: -100%;
			}

			50%,
			100% {
				left: 100%;
			}
		}

		.line:nth-child(2) {
			top: -100%;
			right: 0;
			width: 3px;
			height: 100%;
			background: linear-gradient(180deg, transparent, red);
			animation: animate2 8s linear infinite;
			/* 注意要加上延时触发动画效果，这样线条才会依次触发 */
			animation-delay: 2s;
		}

		@keyframes animate2 {
			0% {
				top: -100%;
			}

			50%,
			100% {
				top: 100%;
			}
		}

		.line:nth-child(3) {
			bottom: 0;
			right: 0;
			width: 100%;
			background: linear-gradient(270deg, transparent, green);
			animation: animate3 8s linear infinite;
			animation-delay: 4s;
		}

		@keyframes animate3 {
			0% {
				right: -100%;
				height: 3px;
			}

			50%,
			100% {
				height: 2px;
				right: 100%;
			}
		}

		.line:nth-child(4) {
			bottom: -100%;
			left: 0;
			width: 3px;
			height: 100%;
			background: linear-gradient(360deg, transparent, #3a86ff);
			animation: animate4 8s linear infinite;
			animation-delay: 6s;
		}

		@keyframes animate4 {
			0% {
				bottom: -100%;
			}

			50%,
			100% {
				bottom: 100%;
			}
		}
	}
</style>